package com.hospital.hospitalserver.controller;

import com.hospital.hospitalserver.entity.GenerateScheduleRequest;
import com.hospital.hospitalserver.entity.ScheduleAIRequest;
import com.hospital.hospitalserver.entity.ScheduleTemplate;
import com.hospital.hospitalserver.service.ScheduleService;
import com.hospital.hospitalserver.util.Pager;
import com.hospital.hospitalserver.util.Response;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 排班管理功能API接口
 * */
@CrossOrigin
@RestController
@RequiredArgsConstructor
@RequestMapping("/schedule")
public class ScheduleController {
    private final ScheduleService scheduleService;

    /**
     * 人员类型定义表信息
     * */
    @GetMapping("/getStaffTypeList")
    public Response getStaffTypeList(){
        return scheduleService.getStaffTypeList();
    }

    /**
     * 班次时间定义表信息
     * */
    @GetMapping("/getTimeSlotList")
    public Response getTimeSlotList(){
        return scheduleService.getTimeSlotList();
    }

    /**
     * 排班类型定义表信息
     * */
    @GetMapping("/getScheduleTypeList")
    public Response getScheduleTypeList(){
        return scheduleService.getScheduleTypeList();
    }

    /**
     * 添加排班模板
     * */
    @PostMapping("/addScheduleTemplate")
    public Response addScheduleTemplate(@RequestBody ScheduleTemplate scheduleTemplate){
        return scheduleService.addScheduleTemplate(scheduleTemplate);
    }

    /**
     * 编辑排班模板
     * */
    @PostMapping("/editScheduleTemplate")
    public Response editScheduleTemplate(@RequestBody ScheduleTemplate scheduleTemplate){
        return scheduleService.editScheduleTemplate(scheduleTemplate);
    }

    /**
     * 装载排班模板分页数据信息给前端API
     * */
    @PostMapping("/getScheduleTemplatePagerDataBySearch")
    public Response getScheduleTemplatePagerDataBySearch(@RequestBody Pager pager){
        return scheduleService.getScheduleTemplatePagerDataBySearch(pager);
    }

    /**
     * 获取排班模板列表数据用于排班
     * */
    @GetMapping("/getScheduleTemplateList")
    public Response getScheduleTemplateList(){
        return scheduleService.getScheduleTemplateList();
    }

    /**
     * 根据AI工作流分析的关键词查询排班模板数据
     * */
    @PostMapping("/queryScheduleTemplateByAI")
    public Response queryScheduleTemplateByAI(@RequestBody ScheduleAIRequest request){
        return scheduleService.queryScheduleTemplate(request);
    }
}
